﻿ package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000117662494";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCGgJZvYxyLfftIJ8neh2yX5LQBIP1EW0g6nQvLFFAlz6wQapwL6PvTwyW+8R/KgBETUXJ4uWP6EeNU0xpERHF8e1D1pZtIzr36IRQwSPVkHANT2fqTMr+madlScVYN/CuV3UbEWfKWzJjL5GXqW1lx//3n3NhjrVoclOxGyM+l2sl2ohdH9IF7mwgReOl8ONKoD1FFsd+r2RnK2KqdGWQe0aXv62gtQALaB2bBNCB8XoTxsLAzeS43sC17yWiE9TZwe8hompLsag/15KHzvnIknZJ/FJrgwrFlT/bDsHyNm+6Nx2GhXstvZkogD8woWlOxj13imPY9yd2OyzAOTDGvAgMBAAECggEAFXxTC6YUeD/+tQ8OE0sk0LrK+mcvrgy65AoUSTOMfg3HmbO+C7UDDVfeHrtb7bg5ghF/rMNIsjjLTNCQIJmiW1VDoIn83UuRU3SXSgNNl9lVur5WZc80iDveaGoMah1/ROhdFp6bvvUd72wjz6UaC7jt8Wz48CtP+sLbX49ShFbKSBcvsUJyqlSys/eO2P4hr92MQnBUAxzLt7IUahpKpjCAnr6RFQtLr6BKIvuxf2+zjXPDT9E5V0qZ/E73YOx7BMba1EtuYttWAaoqq4Iy1GIbGBYiWbabg2nZHeIEhue+enJKPYQc11uxtIsMwgvj9jxkaYuip5qPeG2rcaTXUQKBgQD0u48ukz9PiuBjlRpnTrr4/J3+UjuGqnLsq5pwL0FrNlF7AVQE/ulMD1rOQBuaoVSffEE0k80Dnxd3dXuvCPKoNmUcJpGdcUpEyWS5GUONgvfijqCqBC+0TPQoLz0+2gif+/rnWm6CgY84IIh3SSw9qHGoZ0d89ggrXnJi3uNF2QKBgQCMsdf1MMeV70cG94JDd2O3upLMHd/HU8lWgltM4wF/84A4pOjSFeaaWsb2RoKdAnPHWmgznpVfR662S7oukZsFuSAx3cVOCw/tSTQSewrp8q/AEtpXB9UzxZmvVdjI8IfN9zxui1mSRujrZ8ECVw7Vsj/zsSm1Qg3EmjN9NzpWxwKBgQCFHJcOYCypWQIfZ/QKiLoNv2k38QZLgt4reFLx/eH5LHw5CUnnxbajFh7v29Kn0mQysuTMci+qbpfW8+GoHJfPgnaQTzIYjow0yc2tF960U638XlNo5goEaW7LhJYtX24dhnK772X4OfvqLVfMedJEXyAi1rn9b9yVqjNRL6YyUQKBgBQDvLABp3LZ3iXMkfhdBI9/eCCXY10suyiWVLykUnNMRYJJW2F/ghWVMlaYgz4ouiWy473sIl2yidUfArZbOk1fH4hYfxfyFOrxjfnPDSdowb22MN9OmvLJempp8PPs27TeJfen1S8s7TeHw/o8Pj0CJXzaSA+j/Odp9Ecs0xzDAoGBAJbIbkCCDXpkUM9vz7xEKOlESQivXE/4ctNnu+pNwUSdj7MICAt5ykldHyFsb4WVxA1datm5+++VVVkzeOC3Z85+xibBMzQ0hiyotImMtwATDZsSE6KUQih10TSVOV1Kwsrzc6j4iiWTB9sjMMETK8XEM2s9tt5RozhjtJpjGBOv";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvCqwD/JhtpWxBlJxoqi4fX/0+92EXNviKx1Ys/MSZKt871traUFjKkm1d+dX5QZ6797CIdYnRvjK0NLhDXAFut/rkpwRmQJL5PfTm7ts4CWVrWYBXfg2PeNYDDmNpRk6BDUKs+40btYqbvzDuVBWWl17fJFLnnsm2ASHTN4eddbrVtjecctBJD2E9UJMmGKT+g497M79Xvu0TTBb5zY2kYBsDHdQomDY/4qtWuH8RSMIS805r3nEG8QNcv/6vVWc2shHmvjK9fkqRqPmQQGBjhFMMv9NHPydrUlwwrV/agNPEUFvklTk9qZG8LPvU8iAR9W0GsaXGJnQv9h5v7SfmwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问

	public static String return_url = "http://192.168.7.86:8080/SkyClothes/ToPayServlet";


	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "	\r\n" + 
			"https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

